package fangfayinyong;

import java.util.HashMap;
import java.util.Map;
import java.util.function.Function;

public class Test {
    static String aaa(String str) {
        return "aaa" + str;
    }
    static String bbb(String str) {
        return "bbb" + str;
    }
    static String ccc(String str) {
        return "ccc" + str;
    }

    public String execute(Function<String, String> function, String str) {
        return function.apply(str);
    }

    public static void main(String[] args) {
        // TODO  利用 Function 提供不同的处理逻辑
        Map<String, Function<String, String>> functionMap = new HashMap();
        functionMap.put("aaa", Test::aaa);
        functionMap.put("bbb", Test::bbb);
        functionMap.put("ccc", Test::ccc);

        System.out.println(new Test().execute(functionMap.get("aaa"), "function"));
    }
}
